# Created with pycharm
# author:ju bai
# Date:2021/7/20
# Time:9:59
from selenium import webdriver
import time
import os

driver = webdriver.Chrome()
# 本地HTML
url = "file:///"+os.path.abspath("D:/Python/selenium2html/frame.html")
driver.get(url)
# 多层框架：默认页面->f1->f2
# 从默认页面转到f1页面，再转到f2
driver.switch_to.frame("f1")
driver.switch_to.frame("f2")

driver.find_element_by_id("kw").send_keys("姜云升")
driver.find_element_by_id("su").click()

time.sleep(3)

# 从f2页面可以直接跳转到f1页面吗？不行
# 先回到默认页面
driver.switch_to.default_content()
# 从默认页面回到f1
driver.switch_to.frame("f1")
driver.find_element_by_link_text("click").click()
time.sleep(6)

driver.quit()
